import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
import query from '@dfeidao/atom-nodejs/db/query';
import { systemid, productid } from '../../atom/config';

interface Message {
	risk_po_name: string,
	risk_po_type_no: string
}

interface IWebResult {
	data: unknown;
	cookie?: {
		[name: string]: string;
	} | null;
	content_type?: string;
	headers?: {
		[key: string]: string;
	};
	attachment?: string;
	redirect?: string;
	status_code?: number;
}
// 表名	risk_point_name				
// 标题	风险点名称				
// 字段名称	字段标题	字段类型	字段长度	是否为空	是否主键
// _id	id	string	50	ⅹ	√
// risk_po_type_no	风险点类型编号	string	50	√	ⅹ
// risk_po_name_no	风险点名称编号	string	50	√	ⅹ
// risk_po_name	风险点名称	string	50	√	ⅹ
// ，取 < 风险点名称 > 表，得到数据：


export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders): Promise<IWebResult> {
	log('Service begin path:e:\Feidao\kh\src\risk-point\zj-000007\s001,action_id:' + action_id);

	const { prepare, exec } = query(action_id, session_id, systemid);
	prepare('risk_point_name', ['risk_po_name', 'risk_po_type_no'], { productid, }, 20, 1, [], []);
	const [data] = await exec();


	log('Service end path:e:\Feidao\kh\src\risk-point\zj-000007\s001,action_id:' + action_id);
	return {
		data: { data }
	};
}
